<?php
defined('_JEXEC') or die;
JHtml::addIncludePath(JPATH_COMPONENT.DS.'helpers');
include 'includes/viewitem.php';
?>
<div class="itemGalleryBlock">

<?php	
	$folder = 'upload/gallery/'.$cf_gallery.'';
	$handle=opendir($folder);
	$i=1;
	while (false!==($file = readdir($handle)))

    {
	$info = pathinfo($file);
	$file_name =  basename($file,'.'.$info['extension']);
	
    if ($file != "." && $file != ".." && $info['extension']=='jpg' || $info['extension']=='png')

    { ;?>
    <div class="itemGalleryImage"><a class="modal" rel="{handler: 'image'}" href="<?php echo $this->baseurl ?>/<?php echo $folder;?>/<?php echo $file;?>" title="<?php echo $file_name;?>"><img src="includes/slir/?w=<?php echo $cf_gallery_width;?>&amp;h=<?php echo $cf_gallery_height;?>&amp;q=<?php echo $cf_gallery_quality;?>&amp;c=<?php echo $cf_gallery_ratio;?>&amp;i=<?php echo $this->baseurl ?>/<?php echo $folder;?>/<?php echo $file;?>" alt="<?php echo $this->item->title;?> <?php echo $i ;?>"/></a>
    <em><?php echo $file_name;?></em>
    </div>
      
   
    <?php $i++;?>
	<?php }
    }
	closedir($handle); 
	?>  
    <div class="clr"></div>

</div>